<%@ Page validateRequest="false" Language="vb" AutoEventWireup="false" Codebehind="AdjustQuantity.aspx.vb" Inherits="MIMS_WRS.Web.AdjustQuantity"%>
<%@ Register TagPrefix="uc1" TagName="HelpCtrl" Src="../Controls/HelpCtrl.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Header" Src="../Controls/Header.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Footer" Src="../Controls/Footer.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
	<HEAD>
		<title>Adjust Order Quantity</title>
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		<script language="javascript" src="../Js/popcalendar.js"></script>
		<script language="javascript" src="../Js/common.js"></script>
		<LINK href="../style.css" type="text/css" rel="stylesheet">
		<script language="JavaScript" src="../js/function.js" type="text/JavaScript"></script>
		<script language="javascript">
		<!--
			
		function body_onload() {
			if (window.document.getElementById('btnCancel'))
				window.document.getElementById('btnCancel').onclick = btnCancel_onclick;
		}						
		
		function btnCancel_onclick() {
			return confirm('Are you sure you want to cancel?');
		}
		
		function OpenUserList(obj, objName, objID) {			
			var pos = calcBelowPosition(obj, 190);			
			var w = 400;
			var h = 250;
			lpos=(screen.width - w)/2
			tpos=(screen.height - h)/2		

			var reval;
			var title = "Select a user";
			var url=escape('popup_internaluser.htm');
			reval = window.showModalDialog('../Dialogs/ShowDialog.aspx?title='+escape(title)+'&src='+url,"","dialogHeight: " + h + "px; dialogWidth: " + w + "px; dialogTop: " + tpos + "px; dialogLeft: " + lpos + "px; edge: Raised; center: Yes; help: No; resizable: No; status: No;")
			
			if (reval != null) {
				objName.value = reval.Name;
				objID.value = reval.ID;	
				return true;
			}
			return false;
		}

		function OpenCCList(obj) {
			var id = parseInt(window.document.getElementById('hidCustomerID').value, 10);
			if (id<0) return false;			
			
			var pos = calcBelowPosition(obj, 190);	
			var wi = 550;
			var he = 350;
			var lpos=(screen.width - wi)/2
			var tpos=(screen.height - he)/2		
		
			var reval;
			var title = "Select a contact for this customer";
			//var url=escape('CustomerContactListDialog.aspx?cid='+id);			
			var url=escape('Popup_Contact.aspx?cid='+id);			
			reval = window.showModalDialog('../Dialogs/ShowDialog.aspx?title='+escape(title)+'&src='+url,"","dialogHeight: " + he + "px; dialogWidth: " + wi + "px; dialogTop: " + tpos + "px; dialogLeft: " + lpos + "px; edge: Raised; center: Yes; help: No; resizable: No; status: No;")
			
			if (reval != null) {
				window.document.getElementById('txtAdjApprovedBy').value = reval.Name;
				window.document.getElementById('hidAdjApprovedBy').value = reval.ID;				
				return true;
			}
			
			return false;
		}
		
		function QuantityCheck(src, arg) 
		{
			var s = src.id
			var idx = s.lastIndexOf("_")
			var ctrl = s.substring(0,idx)
			var ddl=window.document.getElementById(ctrl + '_lblPack');				
			arg.IsValid = (parseInt(arg.Value, 10) % parseInt(ddl.innerHTML, 10) == 0)		
		}
		
		//-->
		</script>
	</HEAD>
	<body leftMargin="0" topMargin="0" onload="body_onload();MM_preloadImages('../images/b_weeklyreporto.gif','../images/b_historyreporto.gif','../images/b_usero.gif')">
		<form id="Form1" method="post" runat="server">
			<table cellSpacing="0" cellPadding="0" width="100%" border="0">
				<uc1:header id="Header1" runat="server"></uc1:header>
				<!--Submenu: Start -->
				<tr>
					<td height="30" align="center" class="bgsubmenu"><div class="nlink">
							<table width="96%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td class="txtcolor2"><span class="txtsmall"><strong>You are here:</strong></span> <a href="../Internal/OrderList.aspx">
											Order list</a> / Adjust order quantity
									</td>
									<td align="right" class="txtcolor2"><p><a href="../Internal/OrderInput.aspx"><strong>Create New 
													Order</strong></a></p>
									</td>
									<td width="70" align="right" nowrap class="txtcolor2"><span class="plink"><a href="javascript:history.back()"><img src="../images/b_back.gif" width="57" height="16" hspace="2" vspace="0" border="0"></a></span></td>
								</tr>
							</table>
						</div>
					</td>
				</tr>
				<tr>
					<td height="1" class="bglinetop1"><img src="../images/1pxl.gif" width="1" height="1"></td>
				</tr>
				<!--Submenu: End -->
				<!--DataTable : start-->
				<tr>
					<td align="center" class="bgwhite">
						<table width="90%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td height="10" align="center"><img src="../images/1pxl.gif" width="1" height="1"></td>
							</tr>
							<tr>
								<td height="35" align="center"><table width="100%" border="0" cellpadding="0" cellspacing="0">
										<tr>
											<td width="56%" height="25" valign="bottom">
												<span class="title"><strong><strong>ADJUST ORDER QUANTITY</strong></strong></span></td>
											<td width="44%" align="right" valign="bottom"><div class="plink">
													<span class="txtcolor2"><strong><span class="txtsmall"><a href="#">
																	<uc1:HelpCtrl id="HelpCtrl1" runat="server"></uc1:HelpCtrl>
																</a></span></strong></span>
												</div>
											</td>
										</tr>
									</table>
									<table width="100%" height="25" border="0" cellpadding="0" cellspacing="0" id="msgTable"
										style="DISPLAY:none">
										<tr>
											<td align="center" class="txthighlight">Your Order Quantity has been updated 
												successfully!</td>
										</tr>
									</table>
								</td>
							</tr>
							<tr>
								<td align="center" valign="top">
									<table width="100%" border="0" cellpadding="2" cellspacing="2" class="border1">
										<TBODY>
											<tr>
												<td align="center" bgcolor="#f9f9f9">
													<TABLE width="100%" border="0" cellPadding="3" cellSpacing="0">
														<TR class="bgmenu">
															<TD width="44%" height="20" align="right">&nbsp;</TD>
															<TD width="0%" align="center">&nbsp;</TD>
															<TD width="56%">&nbsp;</TD>
														</TR>
														<TR class="txtnormal">
															<TD align="right">Customer:</TD>
															<TD align="center">&nbsp;</TD>
															<TD class="txtcolor2"><strong><asp:label id="lblCustomerName" runat="server"></asp:label></strong></TD>
														</TR>
														<TR class="txtnormal">
															<TD align="right">PO/BO Order No.:</TD>
															<TD align="center">&nbsp;</TD>
															<TD class="txtcolor2"><strong><asp:label id="lblOrderNo" runat="server"></asp:label></strong></TD>
														</TR>
														<TR class="txtnormal">
															<TD height="25" align="right">Adjusted by:</TD>
															<TD align="center">&nbsp;</TD>
															<TD>
																<table border="0" cellspacing="0" cellpadding="0">
																	<tr>
																		<td><asp:textbox id="txtAdjBy" runat="server" CssClass="txtsmall" Width="160px" ToolTip="Click on button to the right to select"
																				ReadOnly="True"></asp:textbox></td>
																		<td><A onclick="OpenUserList(this, window.document.getElementById('txtAdjBy'), window.document.getElementById('hidAdjBy'))"
																				href="javascript:doNothing()"><IMG height="20" hspace="1" src="../images/b_browse.gif" width="22" border="0"></A></td>
																		<td><SPAN class="txthighlight"><STRONG>*</STRONG></SPAN>
																			<asp:requiredfieldvalidator id="RequiredFieldValidator2" runat="server" CssClass="txthighlight" ErrorMessage="Missing adjusted quantity"
																				Display="Dynamic" ControlToValidate="txtAdjBy">required</asp:requiredfieldvalidator><INPUT id="hidAdjBy" type="hidden" name="hidAdjBy" runat="server"></td>
																	</tr>
																</table>
															</TD>
														</TR>
														<TR class="txtnormal">
															<TD align="right" nowrap>Adjusted Date:</TD>
															<TD align="center">&nbsp;</TD>
															<TD>
																<table border="0" cellspacing="0" cellpadding="0">
																	<tr>
																		<td><asp:textbox id="txtAdjDate" runat="server" CssClass="txtsmall" Width="80px" ToolTip="Click on button to the right to select"
																				ReadOnly="True"></asp:textbox></td>
																		<td><A onclick="popUpCalendar(this, window.document.getElementById('txtAdjDate'), '<%= MIMS_WRS.Business.Common.GetDateFormat %>')" href="javascript:doNothing()" ><IMG height="20" hspace="1" src="../images/b_date.gif" width="22" border="0"></A></td>
																		<td><strong><span class="txthighlight">*</span></strong>
																			<asp:requiredfieldvalidator id="RequiredFieldValidator3" runat="server" CssClass="txthighlight" ErrorMessage="Missing adjusted quantity"
																				Display="Dynamic" ControlToValidate="txtAdjDate">required</asp:requiredfieldvalidator></td>
																	</tr>
																</table>
															</TD>
														</TR>
														<TR class="txtnormal">
															<TD align="right">Adjusted Order Approved by:</TD>
															<TD align="center">&nbsp;</TD>
															<TD>
																<table border="0" cellspacing="0" cellpadding="0">
																	<tr>
																		<td><asp:textbox id="txtAdjApprovedBy" runat="server" CssClass="txtsmall" Width="160px" ToolTip="Click on button to the right to select"
																				ReadOnly="True"></asp:textbox></td>
																		<td><A onclick="OpenCCList(this)" href="javascript:doNothing()"><IMG height="20" hspace="1" src="../images/b_browse.gif" width="22" border="0"></A></td>
																		<td><span class="txthighlight"><strong>*</strong></span>
																			<asp:requiredfieldvalidator id="RequiredFieldValidator4" runat="server" CssClass="txthighlight" ErrorMessage="Missing adjusted quantity"
																				Display="Dynamic" ControlToValidate="txtAdjApprovedBy">required</asp:requiredfieldvalidator></td>
																	</tr>
																</table>
																<INPUT id="hidAdjApprovedBy" type="hidden" name="hidAdjApprovedBy" runat="server">
															</TD>
														</TR>
														<TR class="txtnormal">
															<TD align="right">Approval Date:</TD>
															<TD align="center">&nbsp;</TD>
															<TD>
																<table border="0" cellspacing="0" cellpadding="0">
																	<tr>
																		<td><asp:textbox id="txtApprovalDate" runat="server" CssClass="txtsmall" Width="80px" ToolTip="Click on button to the right to select"
																				ReadOnly="True"></asp:textbox></td>
																		<td><A onclick="popUpCalendar(this, window.document.getElementById('txtApprovalDate'), '<%= MIMS_WRS.Business.Common.GetDateFormat %>')" href="javascript:doNothing()" ><IMG height="20" hspace="1" src="../images/b_date.gif" width="22" border="0"></A></td>
																		<td><span class="txthighlight"><strong>*</strong></span>
																			<asp:requiredfieldvalidator id="RequiredFieldValidator5" runat="server" CssClass="txthighlight" ErrorMessage="Missing adjusted quantity"
																				Display="Dynamic" ControlToValidate="txtApprovalDate">required</asp:requiredfieldvalidator>
																		</td>
																	</tr>
																</table>
															</TD>
														</TR>
														<TR class="txtnormal">
															<TD align="right">&nbsp;</TD>
															<TD align="center">&nbsp;</TD>
															<TD>&nbsp;</TD>
														</TR>
													</TABLE>
													<asp:Repeater id="repProInfo" runat="server">
														<ItemTemplate>
															<tr class="bgwhite">
																<td><%# DataBinder.Eval(Container, "DataItem.ProductInfo") %></td>
																<td align="right" id="packText"><asp:Label id="lblPack" Runat="server"><%# DataBinder.Eval(Container, "DataItem.Packing") %></asp:Label></td>
																<td align="center"><span class="txthighlightsmall">Quantity: <b>
																			<%# DataBinder.Eval(Container, "DataItem.Quantity") %>
																		</b></span>
																</td>
																<td align="center">
																	<asp:TextBox  Text='<%# DataBinder.Eval(Container, "DataItem.AdjustQuantity") %>' Width="50px" onkeypress="NumberOnly(0)" MaxLength="5" ID="txtQuantity" Runat="server"
																		class="numerictxtsmall">
																	</asp:TextBox>
																	<asp:comparevalidator id="comvQuantity2" runat="server" CssClass="txthighlight" ControlToValidate="txtQuantity"
																		Display="Dynamic" ErrorMessage="Adjust quantity must be greater than 0" Type="Integer" Operator="GreaterThan"
																		ValueToCompare="0">must > 0</asp:comparevalidator>
																	<asp:customvalidator id="cusvQuantityCheck" runat="server" CssClass="txthighlight" ErrorMessage="Quantity must be a multiple number of packing"
																		ControlToValidate="txtQuantity" Display="Dynamic" ClientValidationFunction="QuantityCheck"></asp:customvalidator>
																	<input type="hidden" runat="server" id="hidOrderItemIndex" value='<%# DataBinder.Eval(Container, "DataItem.OrderItemIndex") %>' NAME="hidOrderItemIndex"></td>
															</tr>
														</ItemTemplate>
														<HeaderTemplate>
															<table class="bglinetop1" cellSpacing="1" cellPadding="3" width="100%" border="0">
																<tr class="bggrey">
																	<td align="center" width="42%" height="25" rowSpan="2"><strong>Product Information</strong><br>
																		(Code-Description-Color)</td>
																	<td align="center" width="18%" height="25" rowSpan="2"><strong>Packing</strong></td>
																	<td align="center" colSpan="2"><strong>Quantity</strong></td>
																</tr>
																<tr class="txtnormal">
																	<td class="bggrey" align="center" width="20%"><strong>Last Value </strong>
																	</td>
																	<td width="20%" align="center" class="bggrey"><strong>Adjusting Quantity</strong></td>
																</tr>
														</HeaderTemplate>
														<FooterTemplate>
									</table>
									</FooterTemplate> </asp:Repeater>
									<TABLE width="100%" border="0" cellPadding="3" cellSpacing="0">
										<TR class="txtnormal">
											<TD height="30" align="right" valign="bottom" class="bgsubmenu">All fields with red 
												(<span class="txthighlight">*</span>) mark are required field.</TD>
										</TR>
										<TR class="txtnormal">
											<TD height="40" align="center" class="txtsmall">
												<asp:button id="btnOK" runat="server" CssClass="button" Text="Save"></asp:button>&nbsp;<asp:button id="btnReset" runat="server" CssClass="button" Text="Reset" CausesValidation="False"></asp:button>&nbsp;<asp:button id="btnCancel" runat="server" CssClass="button" Text="Cancel" CausesValidation="False"></asp:button>
											</TD>
										</TR>
									</TABLE>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td align="right">&nbsp;</td>
				</tr>
			</table>
			</TD></TR> 
			<!--DataTable : start-->
			<uc1:footer id="Footer1" runat="server"></uc1:footer><INPUT id="hidCustomerID" runat="server" type="hidden">
			</TBODY></TABLE>
		</form>
	</body>
</HTML>
